package com.dullfox.sbm.common.bean;

import com.github.pagehelper.Page;

import java.util.Collection;
import java.util.List;

/**
 * Author: zengdy
 * Date: 2018/10/31
 */
public class PageResult<T> extends Result {
    private List<T> rows;
    private long total;

    public PageResult(List<T> rows) {
        if (rows instanceof Page) {
            Page page = (Page) rows;
            this.rows = page;
            this.total = page.getTotal();
        } else if (rows instanceof Collection) {
            this.rows = rows;
            this.total = (long) rows.size();
        }
    }

    public List<?> getRows() {
        return rows;
    }

    public void setRows(List<T> rows) {
        this.rows = rows;
    }

    public long getTotal() {
        return total;
    }

    public void setTotal(long total) {
        this.total = total;
    }
}
